package com.xgry.bpm.api.base.sqldata.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

public interface SqlData {

	//主表具体数据内容查询接口
	JSONArray findsAll(int formListId)throws Exception;

	void newCreateTable(JSONObject json)throws Exception;

	void delete(JSONArray jsonArray)throws Exception;

	JSONObject insertData(JSONArray jsonArray)throws Exception;

	JSONObject updateData(JSONArray jsonArray)throws Exception;

	void newCreateField(JSONObject jsonObject) throws Exception;

	void createKey(JSONObject jsonObject)throws Exception;

	JSONArray findAll(int formListId)throws Exception;

	JSONArray findsPage(int formListId,Integer pageIndex,Integer pageSize)throws Exception;


	JSONArray findById(JSONObject jsonObject)throws Exception;

	void createStable(JSONObject json)throws Exception;

	JSONArray referenceTest(JSONObject jsonObject)throws Exception;


	JSONObject Select(JSONArray jsonArray)throws Exception;


	JSONArray casaedNew(JSONObject jsonObject)throws Exception;


	void  insertImprest(JSONArray jsonArray)throws Exception;

	JSONArray findByParentLevel(String tableName,String parentLevel)throws Exception;

	//	String Createkey(String tableName, String tableName2, String filedName);
//
//	String deleteBase(String tableName, Map<String, Object> maps);
//
//	String findAll(String tableName, String maps);
//
	String updateBase(String tableName, Map<String, Object> maps, String tableId);

	String selected();

	void insertuser(JSONArray jsonArray)throws Exception;

	void deleteField(String tablename, String field)throws Exception;

	String updateBaseTwo(String tableName, Map<String, Object> maps, String tableId);

	String findCode(String str) throws Exception;

	String findSum(String str)throws Exception;
	String findFormState(String str)throws Exception;
	//
//	String insertBase(String tableName, Map<String, Object> maps);
//
//	String createTable(String tableName, List<CreateTable> createTables);
//
//
//
//	String findById(String tableName, Map<String, String> maps);
//
	String findAll1(String tableName);
	//
//	String multiTable(String tableName, Map<String, String> fileldMap, List<TableField> tableFileId);
//
//	String deleteBaseForm(String tableName, String tableId);
//
//	String TechnologicalTable(String tableName, List<TableField> tableFileId, String processInstanceId);
//
//	String FormByMtableId(String mTableName, List<String> sTable, String mTableId);
//
//	String deleteBaseFormAndStable(String tableName, String mTableId);
//
//	String findByMtableId(String tableName, String id);
//
//	String findByStableId(String tableName, String mTableId);
//
//	String objectFindByIdin(String cTableName, String map);
//
//	//拼接级联sql,返回的字段，查询表，查询条件Key值，value值
	List<Map<String,Object>> cascade(String returnFileld, String cTableName, String fileld, String fileldValue) throws Exception;
	//
//	String dbSourceAndRole(String tableName, String id, List<TableField> tableFileId);
//
	String findByMtableIdDaoStable(String sTableName, String mTableId);
	//
	String selectValue(String cTableName, String tableField, String tableValue)throws Exception;
	//
	String findByprocessInstanceId(String tableName, Map<String, String> maps);
	//
//	String insertField(String tableName, String field, String fieldType);
//
	String createTree(String tableName, List<String> fieldList, List<String> tableList, String parent_level, int tree, String treeName, int childrenNumber) throws Exception;
	//
//	String insertBaseOutPut(String tableName, Map<String, Object> maps);
//
	String apaTree(String tableName, List<String> fieldList, List<String> tableList, String parentId);
	//
	String apaTree1(String tableName, List<String> fieldList, List<String> tableList, String parentId) throws Exception;
	//
	String apaTree2(String tableName, List<String> fieldList, List<String> tableList, String parentId);
	//
	String createCompanyJsonSql(String tableName, List<String> fieldList, List<String> tableList, String parentId) throws Exception;
	//
	String comTree1(String tableName, List<String> fieldList, List<String> tableList, String parentId);


//
//	String deleteTable(String tableName);
//	//刪除视图
//	String deleteView(String viewName);
//	//新建视图
//	String createView(String viewName, List<String> sList, String tableName);
//	//查询视图的sql语句
//	String viewSql(String viewName, List<String> sList);
//	//查询表单的视图sql
//	String formViewSql(String tableViewName, Map<String, String> mList, List<String> sList);
//	//创建表单视图
//	String createFormViewSql(String tableViewName, Map<String, String> mList, List<String> sList);
//
//	String deleteField(String tableName, String field);
//	//查询约束
//	String findConstraint(String tableName, String field);
//	//删除约束
//	String deleteConstraint(String tableName, String constraintName);
//	//根据父级ID查询数据
//	String  findByParentLevel(String tableName, String parentLevel);
//	//删除外键关联关系
//	String deleteFileForeignKey(String tableName, String keyName);
//
//	String findByRef(String fieldName, String tableName, String key, String value);
//
//	String findByDb(String tableName, Map<String, String> maps, List<String> sList);
//
//	String findByArchives(String tbleName, String tableFieldKey, String tableFileValue);

	JSONArray casefind(int formListId)throws Exception;

	List<Map<String,Object>> findByLike(int formListId,String findQuery)throws Exception;

	List<Map<String, Object>> findFliter(String str) throws Exception;

	// 查询差旅住宿标准金额
	String selectRstandardAmount(String begin, String end, String province, String area, String selectByTableName) throws Exception;

	// 查询差旅补贴标准金额
	String selectTravelSubsidyStandardAmount(String province, String area, String selectByTableName) throws Exception;

	// 查询报销管理下的单据表名称
	List<Map<String,Object>> findTableName() throws Exception;

//    // 查询所有付款单据的formlistId、tableName
//	List<Map<String,Object>> selctDocumentPayment(List<Map<String, Object>> tableNameList) throws Exception;
//
//	// 查询所有单据终审后的数据集
//    JSONArray findFinalDocument(List<Map<String, Object>> list) throws Exception;

	// 查询所有终审单据
	JSONArray selectFinalDocument(List<Map<String, Object>> tableNameList) throws Exception;
	//查询所有自己的审批
	JSONArray selectTask(List<Map<String,Object>>tableNameList, HttpSession session) throws Exception;
	//根据条件查询所有自己的审批
	JSONArray selectTaskTwo(List<Map<String,Object>>tableNameList, HttpSession session,JSONObject jsonStr) throws Exception;

	int count(int formListId) throws Exception;
}
